-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add empty_drop
#8571
add empty_drop
#8571
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @flip1995 (or someone else) soon. Please see the contribution instructions for more information. |
After some discussion with fellow devs, they advise I switch this from |
As you can see on many Clippy tests, lints behave differently on types that have a One example where you might want to use this is Since there isn't any alternative to implementing So for me the question is if this lint should be |
I have changed the lint to be a restriction lint |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks I only noticed an edge case that you might want to address and some comments about the documentation. Great first contribution overall!
clippy_lints/src/empty_drop.rs
Outdated
// span_lint_and_help(cx, EMPTY_DROP, item.span, "empty drop implementation", None, "try removing this impl"); | ||
span_lint_and_sugg(cx, EMPTY_DROP, item.span, "empty drop implementation", "try removing this impl", String::new(), Applicability::MaybeIncorrect); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// span_lint_and_help(cx, EMPTY_DROP, item.span, "empty drop implementation", None, "try removing this impl"); | |
span_lint_and_sugg(cx, EMPTY_DROP, item.span, "empty drop implementation", "try removing this impl", String::new(), Applicability::MaybeIncorrect); | |
span_lint_and_sugg( | |
cx, | |
EMPTY_DROP, | |
item.span, | |
"empty drop implementation", | |
"try removing this impl", | |
String::new(), | |
Applicability::MaybeIncorrect, | |
); |
Do I still need the |
Not sure if you can completely remove it (I don't think so), but you can leave it empty. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. With squashed commits and CI passing, this should be ready to get merged.
I'm not quite a git master, is there anything I have to do for squashing commits? |
Let me do it for you then. You can do this with |
@bors r+ Thanks! |
☔ The latest upstream changes (presumably #8576) made this pull request unmergeable. Please resolve the merge conflicts. |
This will need another rebase. |
Sorry! Got caught up this weekend, I'll get to this sometime tonight however. |
And by tonight I meant 2 days later, sorry for the delay! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, this LGTM now. Great first contribution.
Can you squash your commits please. While you're at it you can also rebase them on the current master to get rid of merge commits. The Rust porject has a no-merge-policy
You can do this with:
git rebase -i master
# An editor will open, where you can "squash" your commits
# You might have to fix some conflicts
git diff -- clippy_lints/src/empty_drop.rs # Should be empty
I recommend that you run the usual commands again:
cargo dev update_lints
cargo dev fmt
cargo test
If all that passes, you can force push your changes
git push --force-with-lease
This rebased seemed to have gone wrong. Let me try to fix that. |
@bors r+ |
📌 Commit 7a99a1c has been approved by |
add `empty_drop` Closes #8352 changelog: New lint [`empty_drop`]
💔 Test failed - checks-action_dev_test |
@bors r+ |
📌 Commit 8de3fb1 has been approved by |
☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test |
Thank you! Someone had made a fixed branch for me but I didn't get the chance to fix it yesterday |
Closes #8352
changelog: New lint [
empty_drop
]